package com.cs.code.enums;

import com.cs.core.common.BaseEnum;

import java.util.stream.Stream;

/**
 * @package com.cs.core.enums
 * @class NameType
 * @desc 命名类型
 * @author wind
 * @date    2023/9/19 14:39
 * @version v1.0
 */
public enum NameType implements BaseEnum<Integer> {

    /**
     * hello_world
     */
    DEFAULT(0),

    /**
     * helloWorld
     */
    LOWER_CAMEL(1),

    /**
     * HelloWorld
     */
    UPPER_CAMEL(2),
    ;

    private final Integer code;

    NameType(Integer code) {
        this.code = code;
    }

    @Override
    public boolean eq(Integer integer) {
        return this.code.equals(integer);
    }

    public static NameType getType(Integer type){
        return Stream.of(NameType.values()).filter(s -> s.eq(type)).findFirst().orElse(NameType.DEFAULT);
    }
}
